package cn.test;
//懒汉式单例模式
public class LazySingleton {
    private static LazySingleton instance;
    private LazySingleton(){

    }
    //A,B
    public static synchronized LazySingleton getInstance(){
        if(instance==null){
            instance=new LazySingleton();
        }
        return instance;
    }
    public void show(){
        System.out.println("单例模式show");
    }
}
